import request from 'umi-request';

export async function queryManagementList(params,value = {}) {
  return request('/hr-ssc/api/api-admin/promotion/getPromotionList', {
    method: 'post',
    data: {
      pageNum: params.current,
      pageSize: params.pageSize,
      promotionKind : 0,
      promotionType :2,
      userCode:params.code,
      name:params.name,
      expeditionStatus:parseInt(value),
      isSelf:0
    },
  }).then((res) => {
      const data = res.data;
      return {
        current: data.currPage,
        data: data.list,
        pageSize: data.pageSize,
        success: true,
        total: data.totalCount,
      };
  });
}

export async function getDepartmentUser(orgId) {
  return request(`/hr-ssc/api/api-admin/roleAssignment/getDepartmentUser?orgId=${orgId}`, {
    method: 'get',
  }).then((res) => {
    return res.data;
  });
}

export async function getPromotion(userCodeList) {
  return request(`/hr-ssc/api/api-admin/promotion/findEmpByUserCodes`, {
    method: 'post',
    data: {str:userCodeList},
    requestType: 'form',
  }).then((res) => {
    return res.data;
  });
}

export async function saveManagesInfo(params) {
  return request('/hr-ssc/api/api-admin/promotion/doBatchPromotion', {
    method: 'POST',
    data: params,
  });
}

export async function getJobByOrgId(id) {
  return request(`/hr-ssc/api/api-admin/job/findJobByOrgId/${id}`, {
    method: 'get'
  }).then((res) => {
    return res.data;
  });
}

